The following report visualizes incidences and locations of oil spills in California, tracked by the California Department of Fish and Game. First, the spills are visualized on an interactive map to show specific locations. Then, the report compares total number of spill incidences by county.
Data Citation: Lampinen, Mark (2009). Oil Spill Incident Tracking [ds394]. California Department of Fish and Game, Office of Spill Prevention and Response. https://map.dfg.ca.gov/metadata/ds0394.html?5.108.39
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
# attach packages
library(tidyverse)
library(janitor)
library(here)
library(sf)
library(tmap)
library(tmaptools)
# reading in the data
oil <- read_sf(here("data", "ds394", "ds394.shp")) %>%
clean_names()
counties <- read_sf(here("data", "ca_counties_as", "CA_Counties_TIGER2016.shp")) %>%
clean_names() %>%
mutate(county = name) %>%
select(county)
tmap_mode(mode = "view") # setting the tmap to viewing mode
tm_shape(counties) + # baselayer of counties
tm_polygons(alpha = 0) + # make counties transparent to view streetmap beneath it
tm_shape(oil) + # add spatial points of oil spills
tm_dots(col = "brown3")